package o;

import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongArray;

public final class atb {
    private static final auv<?> ॱᐝ = auv.ˋ(Object.class);
    final boolean ʻ;
    private final ThreadLocal<Map<auv<?>, e<?>>> ʻॱ;
    final boolean ʼ;
    private final atv ʼॱ;
    final boolean ʽ;
    private final aud ʽॱ;
    final List<ats> ˊ;
    final String ˊॱ;
    final atw ˋ;
    final int ˋॱ;
    final boolean ˎ;
    final Map<Type, ate<?>> ˏ;
    final boolean ˏॱ;
    final int ͺ;
    final atd ॱ;
    final atq ॱˊ;
    final List<ats> ॱˋ;
    private final Map<auv<?>, ato<?>> ॱˎ;
    final boolean ॱॱ;
    final boolean ᐝ;
    final List<ats> ᐝॱ;

    static class e<T> extends ato<T> {
        private ato<T> ˋ;

        e() {
        }

        public void ˋ(ato<T> o_ato_T) {
            if (this.ˋ != null) {
                throw new AssertionError();
            }
            this.ˋ = o_ato_T;
        }

        public T ˏ(auy o_auy) throws IOException {
            if (this.ˋ != null) {
                return this.ˋ.ˏ(o_auy);
            }
            throw new IllegalStateException();
        }

        public void ˎ(aux o_aux, T t) throws IOException {
            if (this.ˋ == null) {
                throw new IllegalStateException();
            }
            this.ˋ.ˎ(o_aux, t);
        }
    }

    public atb() {
        this(atw.ˋ, asz.IDENTITY, Collections.emptyMap(), false, false, false, true, false, false, false, atq.DEFAULT, null, 2, 2, Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
    }

    atb(atw o_atw, atd o_atd, Map<Type, ate<?>> map, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, atq o_atq, String str, int i, int i2, List<ats> list, List<ats> list2, List<ats> list3) {
        this.ʻॱ = new ThreadLocal();
        this.ॱˎ = new ConcurrentHashMap();
        this.ˋ = o_atw;
        this.ॱ = o_atd;
        this.ˏ = map;
        this.ʼॱ = new atv(map);
        this.ˎ = z;
        this.ॱॱ = z2;
        this.ʼ = z3;
        this.ᐝ = z4;
        this.ʻ = z5;
        this.ʽ = z6;
        this.ˏॱ = z7;
        this.ॱˊ = o_atq;
        this.ˊॱ = str;
        this.ͺ = i;
        this.ˋॱ = i2;
        this.ᐝॱ = list;
        this.ॱˋ = list2;
        List arrayList = new ArrayList();
        arrayList.add(aup.ㆍ);
        arrayList.add(aui.ॱ);
        arrayList.add(o_atw);
        arrayList.addAll(list3);
        arrayList.add(aup.ˊˋ);
        arrayList.add(aup.ˋॱ);
        arrayList.add(aup.ॱॱ);
        arrayList.add(aup.ᐝ);
        arrayList.add(aup.ˏॱ);
        ato ˊ = ˊ(o_atq);
        arrayList.add(aup.ˋ(Long.TYPE, Long.class, ˊ));
        arrayList.add(aup.ˋ(Double.TYPE, Double.class, ॱ(z7)));
        arrayList.add(aup.ˋ(Float.TYPE, Float.class, ˊ(z7)));
        arrayList.add(aup.ʾ);
        arrayList.add(aup.ˊॱ);
        arrayList.add(aup.ॱˋ);
        arrayList.add(aup.ˏ(AtomicLong.class, ˋ(ˊ)));
        arrayList.add(aup.ˏ(AtomicLongArray.class, ˎ(ˊ)));
        arrayList.add(aup.ʻॱ);
        arrayList.add(aup.ˊᐝ);
        arrayList.add(aup.ˎˎ);
        arrayList.add(aup.ˌ);
        arrayList.add(aup.ˏ(BigDecimal.class, aup.ˊˊ));
        arrayList.add(aup.ˏ(BigInteger.class, aup.ˋˊ));
        arrayList.add(aup.ˏˏ);
        arrayList.add(aup.ˏˎ);
        arrayList.add(aup.ॱʻ);
        arrayList.add(aup.ॱʼ);
        arrayList.add(aup.ᐝˋ);
        arrayList.add(aup.ˎˏ);
        arrayList.add(aup.ˊ);
        arrayList.add(aue.ˋ);
        arrayList.add(aup.ᐧ);
        arrayList.add(aur.ˊ);
        arrayList.add(aun.ॱ);
        arrayList.add(aup.ॱͺ);
        arrayList.add(auh.ˋ);
        arrayList.add(aup.ˎ);
        arrayList.add(new aug(this.ʼॱ));
        arrayList.add(new auk(this.ʼॱ, z2));
        this.ʽॱ = new aud(this.ʼॱ);
        arrayList.add(this.ʽॱ);
        arrayList.add(aup.ᶥ);
        arrayList.add(new aum(this.ʼॱ, o_atd, o_atw, this.ʽॱ));
        this.ˊ = Collections.unmodifiableList(arrayList);
    }

    private ato<Number> ॱ(boolean z) {
        if (z) {
            return aup.ʿ;
        }
        return new ato<Number>(this) {
            final /* synthetic */ atb ˊ;

            {
                this.ˊ = r1;
            }

            public /* synthetic */ void ˎ(aux o_aux, Object obj) throws IOException {
                ˋ(o_aux, (Number) obj);
            }

            public /* synthetic */ Object ˏ(auy o_auy) throws IOException {
                return ˎ(o_auy);
            }

            public Double ˎ(auy o_auy) throws IOException {
                if (o_auy.ʻ() != auz.NULL) {
                    return Double.valueOf(o_auy.ॱˊ());
                }
                o_auy.ॱॱ();
                return null;
            }

            public void ˋ(aux o_aux, Number number) throws IOException {
                if (number == null) {
                    o_aux.ᐝ();
                    return;
                }
                atb.ˋ(number.doubleValue());
                o_aux.ˏ(number);
            }
        };
    }

    private ato<Number> ˊ(boolean z) {
        if (z) {
            return aup.ʽॱ;
        }
        return new ato<Number>(this) {
            final /* synthetic */ atb ˏ;

            {
                this.ˏ = r1;
            }

            public /* synthetic */ void ˎ(aux o_aux, Object obj) throws IOException {
                ˏ(o_aux, (Number) obj);
            }

            public /* synthetic */ Object ˏ(auy o_auy) throws IOException {
                return ॱ(o_auy);
            }

            public Float ॱ(auy o_auy) throws IOException {
                if (o_auy.ʻ() != auz.NULL) {
                    return Float.valueOf((float) o_auy.ॱˊ());
                }
                o_auy.ॱॱ();
                return null;
            }

            public void ˏ(aux o_aux, Number number) throws IOException {
                if (number == null) {
                    o_aux.ᐝ();
                    return;
                }
                atb.ˋ((double) number.floatValue());
                o_aux.ˏ(number);
            }
        };
    }

    static void ˋ(double d) {
        if (Double.isNaN(d) || Double.isInfinite(d)) {
            throw new IllegalArgumentException(d + " is not a valid double value as per JSON specification. To override this behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method.");
        }
    }

    private static ato<Number> ˊ(atq o_atq) {
        if (o_atq == atq.DEFAULT) {
            return aup.ᐝॱ;
        }
        return new ato<Number>() {
            public /* synthetic */ void ˎ(aux o_aux, Object obj) throws IOException {
                ˊ(o_aux, (Number) obj);
            }

            public /* synthetic */ Object ˏ(auy o_auy) throws IOException {
                return ˊ(o_auy);
            }

            public Number ˊ(auy o_auy) throws IOException {
                if (o_auy.ʻ() != auz.NULL) {
                    return Long.valueOf(o_auy.ͺ());
                }
                o_auy.ॱॱ();
                return null;
            }

            public void ˊ(aux o_aux, Number number) throws IOException {
                if (number == null) {
                    o_aux.ᐝ();
                } else {
                    o_aux.ˊ(number.toString());
                }
            }
        };
    }

    private static ato<AtomicLong> ˋ(final ato<Number> o_ato_java_lang_Number) {
        return new ato<AtomicLong>() {
            public /* synthetic */ void ˎ(aux o_aux, Object obj) throws IOException {
                ˏ(o_aux, (AtomicLong) obj);
            }

            public /* synthetic */ Object ˏ(auy o_auy) throws IOException {
                return ˋ(o_auy);
            }

            public void ˏ(aux o_aux, AtomicLong atomicLong) throws IOException {
                o_ato_java_lang_Number.ˎ(o_aux, Long.valueOf(atomicLong.get()));
            }

            public AtomicLong ˋ(auy o_auy) throws IOException {
                return new AtomicLong(((Number) o_ato_java_lang_Number.ˏ(o_auy)).longValue());
            }
        }.ˋ();
    }

    private static ato<AtomicLongArray> ˎ(final ato<Number> o_ato_java_lang_Number) {
        return new ato<AtomicLongArray>() {
            public /* synthetic */ void ˎ(aux o_aux, Object obj) throws IOException {
                ॱ(o_aux, (AtomicLongArray) obj);
            }

            public /* synthetic */ Object ˏ(auy o_auy) throws IOException {
                return ˎ(o_auy);
            }

            public void ॱ(aux o_aux, AtomicLongArray atomicLongArray) throws IOException {
                o_aux.ˎ();
                int length = atomicLongArray.length();
                for (int i = 0; i < length; i++) {
                    o_ato_java_lang_Number.ˎ(o_aux, Long.valueOf(atomicLongArray.get(i)));
                }
                o_aux.ॱ();
            }

            public AtomicLongArray ˎ(auy o_auy) throws IOException {
                List arrayList = new ArrayList();
                o_auy.ˊ();
                while (o_auy.ˋ()) {
                    arrayList.add(Long.valueOf(((Number) o_ato_java_lang_Number.ˏ(o_auy)).longValue()));
                }
                o_auy.ˎ();
                int size = arrayList.size();
                AtomicLongArray atomicLongArray = new AtomicLongArray(size);
                for (int i = 0; i < size; i++) {
                    atomicLongArray.set(i, ((Long) arrayList.get(i)).longValue());
                }
                return atomicLongArray;
            }
        }.ˋ();
    }

    public <T> ato<T> ˏ(auv<T> o_auv_T) {
        Object obj;
        Map map;
        Map map2 = this.ॱˎ;
        if (o_auv_T == null) {
            obj = ॱᐝ;
        } else {
            auv<T> o_auv_T2 = o_auv_T;
        }
        ato<T> o_ato_T = (ato) map2.get(obj);
        if (o_ato_T == null) {
            Map map3 = (Map) this.ʻॱ.get();
            Object obj2 = null;
            if (map3 == null) {
                HashMap hashMap = new HashMap();
                this.ʻॱ.set(hashMap);
                map = hashMap;
                obj2 = 1;
            } else {
                map = map3;
            }
            e eVar = (e) map.get(o_auv_T);
            if (eVar == null) {
                try {
                    e eVar2 = new e();
                    map.put(o_auv_T, eVar2);
                    for (ats ˎ : this.ˊ) {
                        o_ato_T = ˎ.ˎ(this, o_auv_T);
                        if (o_ato_T != null) {
                            eVar2.ˋ(o_ato_T);
                            this.ॱˎ.put(o_auv_T, o_ato_T);
                            map.remove(o_auv_T);
                            if (obj2 != null) {
                                this.ʻॱ.remove();
                            }
                        }
                    }
                    throw new IllegalArgumentException("GSON (2.8.5) cannot handle " + o_auv_T);
                } catch (Throwable th) {
                    map.remove(o_auv_T);
                    if (obj2 != null) {
                        this.ʻॱ.remove();
                    }
                }
            }
        }
        return o_ato_T;
    }

    public <T> ato<T> ˋ(ats o_ats, auv<T> o_auv_T) {
        if (!this.ˊ.contains(o_ats)) {
            o_ats = this.ʽॱ;
        }
        Object obj = null;
        for (ats o_ats2 : this.ˊ) {
            if (obj != null) {
                ato<T> ˎ = o_ats2.ˎ(this, o_auv_T);
                if (ˎ != null) {
                    return ˎ;
                }
            } else if (o_ats2 == o_ats) {
                obj = 1;
            }
        }
        throw new IllegalArgumentException("GSON cannot serialize " + o_auv_T);
    }

    public <T> ato<T> ˋ(Class<T> cls) {
        return ˏ(auv.ˋ((Class) cls));
    }

    public String ॱ(Object obj) {
        if (obj == null) {
            return ॱ(atl.ˎ);
        }
        return ˏ(obj, obj.getClass());
    }

    public String ˏ(Object obj, Type type) {
        Appendable stringWriter = new StringWriter();
        ˋ(obj, type, stringWriter);
        return stringWriter.toString();
    }

    public void ˋ(Object obj, Type type, Appendable appendable) throws JsonIOException {
        try {
            ˋ(obj, type, ॱ(auc.ˊ(appendable)));
        } catch (Throwable e) {
            throw new JsonIOException(e);
        }
    }

    public void ˋ(Object obj, Type type, aux o_aux) throws JsonIOException {
        ato ˏ = ˏ(auv.ˋ(type));
        boolean ॱॱ = o_aux.ॱॱ();
        o_aux.ˋ(true);
        boolean ʽ = o_aux.ʽ();
        o_aux.ˎ(this.ᐝ);
        boolean ʼ = o_aux.ʼ();
        o_aux.ॱ(this.ˎ);
        try {
            ˏ.ˎ(o_aux, obj);
            o_aux.ˋ(ॱॱ);
            o_aux.ˎ(ʽ);
            o_aux.ॱ(ʼ);
        } catch (Throwable e) {
            throw new JsonIOException(e);
        } catch (Throwable e2) {
            throw new AssertionError("AssertionError (GSON 2.8.5): " + e2.getMessage(), e2);
        } catch (Throwable th) {
            o_aux.ˋ(ॱॱ);
            o_aux.ˎ(ʽ);
            o_aux.ॱ(ʼ);
        }
    }

    public String ॱ(ath o_ath) {
        Appendable stringWriter = new StringWriter();
        ˋ(o_ath, stringWriter);
        return stringWriter.toString();
    }

    public void ˋ(ath o_ath, Appendable appendable) throws JsonIOException {
        try {
            ˋ(o_ath, ॱ(auc.ˊ(appendable)));
        } catch (Throwable e) {
            throw new JsonIOException(e);
        }
    }

    public aux ॱ(Writer writer) throws IOException {
        if (this.ʼ) {
            writer.write(")]}'\n");
        }
        aux o_aux = new aux(writer);
        if (this.ʻ) {
            o_aux.ˋ("  ");
        }
        o_aux.ॱ(this.ˎ);
        return o_aux;
    }

    public auy ˋ(Reader reader) {
        auy o_auy = new auy(reader);
        o_auy.ˊ(this.ʽ);
        return o_auy;
    }

    public void ˋ(ath o_ath, aux o_aux) throws JsonIOException {
        boolean ॱॱ = o_aux.ॱॱ();
        o_aux.ˋ(true);
        boolean ʽ = o_aux.ʽ();
        o_aux.ˎ(this.ᐝ);
        boolean ʼ = o_aux.ʼ();
        o_aux.ॱ(this.ˎ);
        try {
            auc.ˎ(o_ath, o_aux);
            o_aux.ˋ(ॱॱ);
            o_aux.ˎ(ʽ);
            o_aux.ॱ(ʼ);
        } catch (Throwable e) {
            throw new JsonIOException(e);
        } catch (Throwable e2) {
            throw new AssertionError("AssertionError (GSON 2.8.5): " + e2.getMessage(), e2);
        } catch (Throwable th) {
            o_aux.ˋ(ॱॱ);
            o_aux.ˎ(ʽ);
            o_aux.ॱ(ʼ);
        }
    }

    public <T> T ˏ(String str, Class<T> cls) throws JsonSyntaxException {
        return aub.ˏ(cls).cast(ˊ(str, (Type) cls));
    }

    public <T> T ˊ(String str, Type type) throws JsonSyntaxException {
        if (str == null) {
            return null;
        }
        return ˊ(new StringReader(str), type);
    }

    public <T> T ˊ(Reader reader, Type type) throws JsonIOException, JsonSyntaxException {
        auy ˋ = ˋ(reader);
        Object ˎ = ˎ(ˋ, type);
        ˎ(ˎ, ˋ);
        return ˎ;
    }

    private static void ˎ(Object obj, auy o_auy) {
        if (obj != null) {
            try {
                if (o_auy.ʻ() != auz.END_DOCUMENT) {
                    throw new JsonIOException("JSON document was not fully consumed.");
                }
            } catch (Throwable e) {
                throw new JsonSyntaxException(e);
            } catch (Throwable e2) {
                throw new JsonIOException(e2);
            }
        }
    }

    public <T> T ˎ(auy o_auy, Type type) throws JsonIOException, JsonSyntaxException {
        boolean z = true;
        boolean ʻॱ = o_auy.ʻॱ();
        o_auy.ˊ(true);
        try {
            o_auy.ʻ();
            z = false;
            T ˏ = ˏ(auv.ˋ(type)).ˏ(o_auy);
            o_auy.ˊ(ʻॱ);
            return ˏ;
        } catch (Throwable e) {
            if (z) {
                o_auy.ˊ(ʻॱ);
                return null;
            }
            throw new JsonSyntaxException(e);
        } catch (Throwable e2) {
            throw new JsonSyntaxException(e2);
        } catch (Throwable e22) {
            throw new JsonSyntaxException(e22);
        } catch (Throwable e222) {
            throw new AssertionError("AssertionError (GSON 2.8.5): " + e222.getMessage(), e222);
        } catch (Throwable th) {
            o_auy.ˊ(ʻॱ);
        }
    }

    public String toString() {
        return "{serializeNulls:" + this.ˎ + ",factories:" + this.ˊ + ",instanceCreators:" + this.ʼॱ + "}";
    }
}
